package eshop.local.ui;

import java.util.List;
import java.util.Vector;

import javax.swing.table.DefaultTableModel;

import eshop.local.valueobjects.Transfer;

public class TRATableModel extends DefaultTableModel {
	
	public TRATableModel(List<Transfer> tranfList, Vector columNames){
		super();
		Vector rows = new Vector();
		for(Transfer tran: tranfList){
			Vector TransferAlsVektor = new Vector();
			TransferAlsVektor.add(tran.getTnummer());
			TransferAlsVektor.add(tran.getMnummer());
			TransferAlsVektor.add(tran.getAnummer());
			TransferAlsVektor.add(tran.getAnzahl());
			int Datu = Integer.parseInt(tran.getDate());
			String Datum = (Datu%1000)%100 + "." + (Datu%1000)/100 + "." + (Datu/10000);
			TransferAlsVektor.add(Datum);
			rows.add(TransferAlsVektor);
		}
		this.setDataVector(rows, columNames);
	}
}
